cd "~/Dropbox/Shared Folder - J. Ladd & M (1). Meredith/Replication Files/"
cap log close
log using "LogFiles/TableA3.log", replace

clear all
set more off

import excel "RawData/AggregatePresidentialApproval.xlsx", sheet("Sheet1")

tab B 
keep if regexm(B,"Gallup")

tab G
drop if G == "LV" | G == "RV"
drop G

gen temp = strpos(A, "/")
gen start_month = real(substr(A, 1, temp - 1))
gen start_day = substr(A, temp + 1, 2)
replace start_day = subinstr(start_day, "/", "", .)
replace start_day = subinstr(start_day, "-", "", .)
destring start_day, force replace
gen start_year = real(reverse(substr(reverse(A), 1, 2)))
replace start_year = 1900 + start_year if start_year >= 53
replace start_year = 2000 + start_year if start_year <= 12
sort start_year start_month start_day

keep A-F
export excel "ProcessedData/AggregatePresidentialApproval.xlsx", replace

log close
